package com.hu.zhcc.shiro.controller.xsx;


import com.hu.zhcc.shiro.entity.xsx.XsxTCheckitem;
import com.hu.zhcc.shiro.service.xsx.TCheckitemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 检查项表 前端控制器
 * </p>
 *
 * @author xsx
 * @since 2021-06-17
 */
@RestController
@RequestMapping("/tCheckitem")
public class TCheckitemController {

    @Autowired
    TCheckitemService tCheckitemService;

    @GetMapping("/all")
    private List<XsxTCheckitem> queryAll(){
        return tCheckitemService.queryAllCheckitem();
    }

    @GetMapping("/queryCheckitemStatus")
    private List<XsxTCheckitem> queryCheckitemStatus(){
        return tCheckitemService.queryCheckitemStatus();
    }


    @PutMapping("/{num}/cid")
    private int qryy(@PathVariable("num") Integer num, Integer cid){
        if(num==0){
            return tCheckitemService.jyCheckitem(cid);
        }
        if(num==1){
            return tCheckitemService.qyCheckitem(cid);
        }
        return 0;
    }

    @PutMapping("")
    public int updateEmpById(@RequestBody XsxTCheckitem item){
        return tCheckitemService.updateCheckitemOne(item);
    }

    @PostMapping("")
    public int addEmp(@RequestBody XsxTCheckitem item) {
        return tCheckitemService.addCheckitemOne(item);
    }



}

